package cn.iocoder.yudao.module.system.dal.mysql.problem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.problem.ProblemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.problem.vo.*;

/**
 * 问题列 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ProblemMapper extends BaseMapperX<ProblemDO> {

    default PageResult<ProblemDO> selectPage(ProblemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProblemDO>()
                .betweenIfPresent(ProblemDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(ProblemDO::getProblemName, reqVO.getProblemName())
                .eqIfPresent(ProblemDO::getContent, reqVO.getContent())
                .eqIfPresent(ProblemDO::getAnswer, reqVO.getAnswer())
                .orderByDesc(ProblemDO::getId));
    }

}